﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace weba
{
    public partial class addmoban : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            moban b = new moban();
            b.name = this.name.Text.ToString();
            b.nagurl = this.nag.Text.ToString();
            b.ctg = this.ctg.SelectedItem.Value.ToString();
string pt="";
            if (FileUpload1.HasFile)
            {
                pt= FileUpload1.FileName;
            string location1 = Server.MapPath("Images/") + pt;
            FileUpload1.SaveAs(location1);
            }
            
            string pt2="";
          if ( FileUpload2.HasFile)
          {
              pt2 = FileUpload2.FileName;
            string location12 = Server.MapPath("Images/") + pt2;
            FileUpload2.SaveAs(location12);
          }
           
            
            b.tupian = pt.ToString();
            b.bigtupian = pt2.ToString();
            b.text = this.jiesao.Text.ToString();
            mk.l.moban.InsertOnSubmit(b);
            mk.l.SubmitChanges();
            mk.Alert("添加成功,导航到模板编辑页面");
            Response.Redirect("editmoban.aspx");

        }
    }
}